package com.chinawayltd.ews.sample.taskDispatch;

import com.alibaba.fastjson.JSONObject;
import com.chinawayltd.ews.sample.taskDispatch.pojo.BaseTask;

/**
 * @program: greeProject.timingTaskCenter
 * @description:
 * @author: xiazj
 * @create: 2018-07-16 10:33
 **/
public class TaskOrderScreen {

    public static boolean screeningOrder(BaseTask task, JSONObject order){
        Double orderPallet = order.getDouble(TaskDispatchConstants.TASKLIST_PALLET);
        Double taskPallert = task.getCurrentPallet();
        Integer vehicleMaxPallert = task.getMaxPallet();

        Double orderStarttime = order.getDouble(TaskDispatchConstants.TASKLIST_STARTTIME);
        Double minStarttime = task.getMinStarttime();
        //当前任务加上订单板位数不超过车辆最大板位数，且订单最早送货时间跟任务第一个订单的送货时间不超过3小时(3/24 = 0.125)
        if(((orderPallet + taskPallert) <= vehicleMaxPallert) && ((orderStarttime - minStarttime) <= 0.125)){
            return true;
        }
        return false;
    }

}
